home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_0799 / 739 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  2.2 KB

  1. From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
  2. Date: Tue, 4 Jan 94 10:31:36 +0100
  3. Message-Id: <9401040931.AA24042@issan.informatik.uni-dortmund.de>
  4. To: mint@atari.archive.umich.edu
  5. In-Reply-To: <199401030933.AA14748@techfac.TechFak.Uni-Bielefeld.DE> (message from Torsten Scherer on Mon, 3 Jan 94 0:29:54 +0100)
  6. Subject: Re: strange Fselect/Finstat behaviour...
  7.  
  8. This is how i'm interpreting the situation: The keyboard is checked
  9. periodically for the control characters as defined by the tty
  10. settings.  Without MiNT, ^C/^S/^Q is only checked when a program
  11. explicitly reads a character in non-raw mode.  To maintain
  12. compatibility with old programs which uses Crawcin when they don't
  13. want to be killed, there is a flag in the tty settings (TS_COOKED) to
  14. record how the terminal was last read.  If it was last read using RAW
  15. mode, the check for control characters is effectively disabled, and it
  16. is enabled again when reading in COOKED mode.  The problem is that you
  17. don't know how a non-mint-aware program wants to handle ^C/^S until it
  18. actually reads the terminal.
  19.  
  20. Now when using Fread() on a terminal that is set via ioctl() to RAW
  21. mode, the TS_COOKED flag is cleared before any character arrives
  22. (unless you're typing fast enough). On the other hand, when using
  23. Finstat() or Fselect(), the control character arrives before the
  24. terminal is read, and the state reflects the setting of the terminal
  25. at the time the last character was read.
  26.  
  27. Try the patch below: if the terminal is configured with TIOCSETP, the
  28. flag TS_COOKED will now be updated immediately, under the assumption
  29. that a program that uses Fcntl() should be able to handle keyboard
  30. signals gracefully.  This will slightly change the effect of ^C/^S
  31. when a non-mint-aware program is started after a mint-aware program
  32. that reads the terminal in RAW mode.
  33.  
  34. --- orig/tty.c    Fri Jun 25 22:24:58 1993
  35. +++ tty.c    Mon Jan  3 20:01:16 1994
  36. @@ -483,6 +483,11 @@
  37.      case TIOCSETP:
  38.          sg = (struct sgttyb *)arg;
  39.          tty->sg = *sg;
  40. +        /* set the tty state for checking control characters */
  41. +        if (sg->sg_flags & T_RAW)
  42. +          tty->state &= ~TS_COOKED;
  43. +        else
  44. +          tty->state |= TS_COOKED;
  45.      /* set baud rates */
  46.          baud = tosbaud(sg->sg_ispeed);
  47.          (*f->dev->ioctl)(f, TIOCIBAUD, &baud);
  48.